package mortal.game.resource
{
	import com.gengine.resource.*;
	import com.gengine.resource.info.*;
	import flash.utils.*;
	import mortal.common.global.*;
	
	public class ResConfig extends Object
	{
		private var _map:Dictionary;
		private static var _instance:ResConfig;
		
		public function ResConfig()
		{
			this._map = new Dictionary();
			if (_instance != null)
			{
				throw new Error(" ResConfig 单例 ");
			}
			this.init();
			
		}
		
		private function init() : void
		{
			var _loc_1:* = ConfigManager.instance.getByteArrayByFileName("assets.vas");
			_loc_1.uncompress();
			_loc_1.position = 0;
			var _loc_2:* = _loc_1.readObject() as Object;
			this.write(_loc_2);
			
		}
		
		protected function write(param1:Object) : void
		{
			var _loc_2:Class = null;
			var _loc_3:ResourceInfo = null;
			var _loc_4:Object = null;
			for each (_loc_4 in param1)
			{
				
				_loc_2 = FileType.getLoaderInfoByType(_loc_4.type as String);
				if (_loc_2)
				{
					_loc_3 = new _loc_2(_loc_4);
				}
				else
				{
					_loc_3 = new ResourceInfo(_loc_4);
				}
				_loc_3.path = PathConst.mainPath + _loc_3.path;
				ResourceManager.addResource(_loc_3);
			}
			
		}
		
		public function getInfoByName(param1:String) : ResourceInfo
		{
			return ResourceManager.getInfoByName(param1);
		}
		
		public function getUrlByName(param1:String) : String
		{
			var _loc_2:* = ResourceManager.getInfoByName(param1);
			if (_loc_2)
			{
				return _loc_2.path;
			}
			return "";
		}
		
		public static function get instance() : ResConfig
		{
			if (_instance == null)
			{
				_instance = new ResConfig;
			}
			return _instance;
		}
		
	}
}
